﻿#ifndef NOSEPIECELIBLOADER_H
#define NOSEPIECELIBLOADER_H
#include <QLibrary>

#include "NosepieceCommon/NosepieceCommon_global.h"
#include "NosepieceCommon/NosepieceInterface.h"
namespace Qly {

/**
 * @brief The NosepieceLibLoader class 用于加载物镜转盘控制 DLL。
 *        物镜转盘控制 DLL 必须有 CreateInstance 和 Release 这两个接口函数。
 *        后面会将物镜转盘控制、上下光源控制等放到同一个 DLL 中。因此这个类后面会废弃。
 */
class NOSEPIECECOMMON_EXPORT NosepieceLibLoader : public QObject
{
public:
    NosepieceLibLoader(QString dllFullName, QObject *parent);
    NosepieceInterface * createInstance(QObject *p);
    void release(NosepieceInterface * p);

private:
    QLibrary * pNosepieceLib;

    typedef Qly::NosepieceInterface * (*CreateInstanceType)(QObject *);
    typedef void (*ReleaseType)(Qly::NosepieceInterface *);

    CreateInstanceType CreateInstance = nullptr;
    ReleaseType Release = nullptr;
};

}


#endif // NOSEPIECELIBLOADER_H
